package net.onceface.application.impl;

import javax.inject.Named;

import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import net.onceface.application.DeliveryMSGApplication;
import net.onceface.core.mongo.DeliveryMSG;
import net.onceface.infra.domain.MongoBase;

@Named
public class DeliveryMSGApplicationImpl extends MongoBase<DeliveryMSG> implements DeliveryMSGApplication{

	@Override
	public DeliveryMSG findById(String id) {
		setMongoTemplate("mongoTemplate");
		return queryById(id);
	}

	@Override
	public DeliveryMSG findByUserId(int userId) {
		setMongoTemplate("mongoTemplate");
		Criteria criteria = Criteria.where("userId").is(userId);
		return queryOne(new Query(criteria));
	}

}
